You can search on hierarchies in Lucene if your hierarchy can be represented as a path enumeration (a Dewey-Decimal-like style of encoding a path, like "001.014.003" for the 3rd grandchild of the 14th child of the 1st branch).
For example, a search phrase like:
hierarchy:001
would return only the direct children of the 1st branch, while:
hierarchy:001*
would return all descendents of the 1st branch.
hierarchy:001.014.003
hierarchy:001.014.003*
hierarchy:001.014.003.*